<script>
	import Vue from 'vue';
	import helper from 'common/helper.js';
	export default {
		onLaunch: function() {
			uni.getSystemInfo({
				success: function(e) { 
					// #ifndef MP
					Vue.prototype.StatusBar = e.statusBarHeight;
					if (e.platform == 'android') {
						Vue.prototype.CustomBar = e.statusBarHeight + 50;
					} else {
						Vue.prototype.CustomBar = e.statusBarHeight + 45;
					};
					// #endif
			
					// #ifdef MP
					Vue.prototype.StatusBar = e.statusBarHeight;
					let custom = wx.getMenuButtonBoundingClientRect();
					Vue.prototype.Custom = custom;
					Vue.prototype.CustomBar = custom.bottom + custom.top - e.statusBarHeight;
					// #endif
					Vue.prototype.windowHeight = e.windowHeight - Vue.prototype.CustomBar;
					//console.log('e:',e);
					Vue.prototype.ColorList = [{
							title: '嫣红',
							name: 'red',
							color: '#fe0500'
						},
						{
							title: '桔橙',
							name: 'orange',
							color: '#fe6900'
						},
						{
							title: '明黄',
							name: 'yellow',
							color: '#fbbd08'
						},
						{
							title: '橄榄',
							name: 'olive',
							color: '#8dc63f'
						},
						{
							title: '森绿',
							name: 'green',
							color: '#39b54a'
						},
						{
							title: '天青',
							name: 'cyan',
							color: '#1cbbb4'
						},
						{
							title: '海蓝',
							name: 'blue',
							color: '#0081ff'
						},
						{
							title: '姹紫',
							name: 'purple',
							color: '#6739b6'
						},
						{
							title: '木槿',
							name: 'mauve',
							color: '#9c26b0'
						},
						{
							title: '桃粉',
							name: 'pink',
							color: '#e03997'
						},
						{
							title: '棕褐',
							name: 'brown',
							color: '#a5673f'
						},
						{
							title: '玄灰',
							name: 'grey',
							color: '#8799a3'
						},
						{
							title: '草灰',
							name: 'gray',
							color: '#aaaaaa'
						},
						{
							title: '墨黑',
							name: 'black',
							color: '#333333'
						},
						{
							title: '雅白',
							name: 'white',
							color: '#ffffff'
						},
					]
				}
			})
			// this.userlogin();
		},
		onShow: function() {
			//console.log('App Show');
		},
		onHide: function() {
			//console.log('App Hide')
		},
		methods:{
			authorizeUrl() {
				var that = this;
				var url = window.location.href.split('#')[0];
				let comitData = {
					"loginName": "",
					// "loginResultUrl": url,
					"loginResultUrl": url+"#/pages/authorize/index",
					"loginType": "WECHAT_ENTERPRISE_WEB",
					"scanGoal": "1"
				};
				that.$api.authorizeUrl(comitData).then(res =>{
						console.log("authorizeUrl==============",res);
					if (res.code == 0) {
						setTimeout(()=>{
							window.location.href = res.data
						},500)
					} else {
						uni.showToast({
							title: res.message,
							icon: 'none',
							duration: 300
						});
					}
				}).catch(error =>{
					console.log(error);
				})
			},
			userlogin(){
				var that = this;
				let data  = {
					loginName:"zhongtao",
					password:"123456",
					loginType:"NAME_PASSWORD"
				}
				that.$api.userlogin(data).then(res =>{
					console.log("userlogin:",res);
				}).catch(error =>{
					console.log("error:",error);
				})
			}
		}
	}
</script>

<style>
	@import "colorui/animation.css";
	@import "colorui/main.css";
	@import "colorui/icon.css";
	
	page{
		font-family: Microsoft YaHei;
	}
	.main-bg-color{
		background: #142238;
	}
	.index-bg-color{
		position: absolute;
		top: 0;
		width: 100%;
		height: 100%;
		background: #142238;
	}
	.index-bg-view{
		position: absolute;
		top: 0;
		width: 100%;
		height: 100%;
	}
	/* page{
		background: #FFFFFF;
	} */
	/*每个页面公共css */
	.mid-modal-tittle {
		width: 100%;
		position: relative;
	}
	
	.mid-modal-close {
		position: absolute;
		right: 15upx;
		font-size: 35upx;
		
	}
	.cu-dialog{
		width: 90vw;
	}
	.flex-1{
		flex:1
	}
	.flex-2{
		flex:2
	}
	.flex-3{
		flex:3
	}
	.flex-4{
		flex:4
	}
	.index-main-style{
		width: 100%;
		height: 100vh;
		position: relative;
	}
	.index-background {
		width: 100%;
		height: 100%;
	}
	
	.index-background>image {
		width: 100%;
		height: 100%;
	}
	.text-ss{
		font-size: 22rpx;
	}
	.text-dark-blue{
		color: #182b4e;
	}
	.input-border-round{
		border-radius: 50%;
		width: 103rpx;
		height: 103rpx;
	}
	.pda-margin-top{
		/* margin-top: 10rpx; */
	}
	.big-pack-line{
		width: 40rpx;
		height: 2rpx;
	}
</style>
